<?php
	if (isset($_POST['Submit'])) {

		error_reporting(E_ALL ^ E_NOTICE);
		
		$dirme = "../themes/";
		
		$rand = $_FILES['namafile']['name'];
		$rand = explode(".",$rand);
		$rand = $rand[0];
		$fileasli = $_FILES['namafile']['name'];
				
		$newfile = $dirme.$rand.".".file_ext($fileasli);
		//print $namafile;

		if (@move_uploaded_file($_FILES['namafile']['tmp_name'],$newfile)) {
			print "File Theme Was Uploaded";
		} else {
			print "File not Uploaded, Check Permission About your Folder";
		}

		$mk = mkdir($dirme.$rand, 0777);

		if (extract_zip($newfile, $dirme."/")) {
			echo "Zip file was extracted.<br>";
		} else {
			echo "Zip file cannot be uploaded. <br>";
		}
		
		unlink($newfile);
	}
?>
<form action="<? print $_SERVER['REQUEST_URI']; ?>" method="post" enctype="multipart/form-data" name="form1" id="form1">
  <input name="namafile" type="file" id="namafile" />
  <input type="submit" name="Submit" value="Submit" />
</form>
